import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

// 全局注册组件
import PageTools from '@/components/PageTools'
Vue.component('PageTools', PageTools)
import classPageTools from '@/components/classPageTools'
import classImageUpload from '@/components/classImageUpload'
Vue.component('classPageTools', classPageTools)
Vue.component('classImageUpload', classImageUpload)

import '@/icons' // icon
import '@/permission' // permission control

// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)
// 全局注册过滤器
function url(oldVal) {
  return oldVal.split('http')[0]
}
// 注册
Vue.filter('url', url)

import fiximg from '@/directive/fiximg'
Vue.directive('fixImg', fiximg)
// 全局注册组件
// import MyComponents from './components'
// Vue.use(MyComponents)

// import fiximg from '@/directive/fiximg'
// Vue.directive('fixImg', fiximg)

import MyComponents from '@/components'
Vue.use(MyComponents)// 注册自己的插件

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
